package com.rerun.common.util;

import com.baomidou.mybatisplus.plugins.Page;

/**
 * @author dax.
 * @version v1.0
 * @since 2017/11/16 17:03
 */

public class PageHelper {

    private PageHelper() {
    }

    public static <T> int curPageStart(int total, Page<T> page){
          page.setTotal(total);
        int size = page.getSize();
        int p = page.getPages();
        int current = page.getCurrent();
        int cur = (current - 1) * size;
        if (current > p) {
            cur = (p ) * size;
        }
        return cur;
    }
}
